﻿<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
{include file="main"}
<body>
<!--_header 作为公共模版分离出去-->
{include file="header"}
<!--/_header 作为公共模版分离出去-->

<!--_menu 作为公共模版分离出去-->
{include file="side_bar"}
<!--/_menu 作为公共模版分离出去-->

<section class="Hui-article-box">
	<nav class="breadcrumb">
        <i class="Hui-iconfont">&#xe67f;</i><a href="{:url('admin/index/index')}" class="maincolor">首页</a>
        <span class="c-gray en">&gt;</span> 项目 <span class="c-gray en">&gt;</span> 项目列表
        <a class="btn btn-success radius r" id="btn-refresh" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="Hui-article">
		<article class="cl pd-20">
<!--			<div class="text-c">-->
<!--				<input type="text" class="input-text" style="width:250px" placeholder="输入人员名称、电话、邮箱" id="" name="">-->
<!--				<button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>-->
<!--			</div>-->

			<ul id="Huifold1" class="Huifold">
				<li class="item">
					<h4>筛选<b>+</b></h4>
					<div class="info">
						<form action="{:url('project/filter')}" method="get" class="form form-horizontal" id="filter">
							<div class="formControls col-xs-8 col-sm-11 skin-minimal">
								<LABEL>项目类型:&nbsp;&nbsp; </LABEL>
								<div class="check-box">
									<label><input type="checkbox" name="ptype" value="0" id="filter-0">未分类</label>
								</div>
								<div class="check-box">
									<label><input type="checkbox" name="ptype" value="1" id="filter-1">专题</label>
								</div>
								<div class="check-box">
									<label><input type="checkbox" name="ptype" value="2" id="filter-2">频道</label>
								</div>
								<div class="check-box">
									<label><input type="checkbox" name="ptype" value="3" id="filter-3">分网</label>
								</div>
								<div class="check-box">
									<label><input type="checkbox" name="ptype" value="4" id="filter-4">建站</label>
								</div>
								<div class="check-box">
									<label><input type="checkbox" name="ptype" value="5" id="filter-5">系统</label>
								</div>

								<br>

								<LABEL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CMS:&nbsp;&nbsp; </LABEL>
								<div class="check-box">
									<label><input type="checkbox" name="cms" value="阳光网CMS" >阳光网CMS</label>
								</div>
								<div class="check-box">
									<label><input type="checkbox" name="cms" value="TRS" >TRS</label>
								</div>
								<div class="check-box">
									<label><input type="checkbox" name="cms" value="织梦" >织梦</label>
								</div>
							</div>
								<br>
								<input class="btn btn-primary size-MINI radius" type="submit" value="确定">&nbsp;
								<a href={:url('index_with_user')}><input class="btn btn-warning size-MINI radius" type="button" value="清空"></a>
						</form>
					</div>
				</li>
			</ul>

			<div class="cl pd-5 bg-1 bk-gray"> <span class="l">
                <a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
                <a href="javascript:;" onclick=project_add('添加项目',"{:url('create')}",'','500') class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加项目</a></span></div>
			<div class="mt-20">
				<table class="table table-border table-bordered table-hover table-bg table-sort table-striped">
					<thead>
						<tr class="text-c">
							<th width="25"><input type="checkbox" name="" value=""></th>
							<th width="60">ID</th>
							<th width="100">项目名</th>
							<th width="80"><i class="Hui-iconfont Hui-iconfont-tags" data-toggle="popover"  data-placement="top">项目类型</i></th>
							<th width="80">开发人员</th>
							<th width="80">开发语言</th>
							<th width="80">cms</th>
							<th width="120">前台地址</th>
							<th width="100">服务器地址</th>
							<th width="80">创建时间</th>
							<th width="100">操作</th>
						</tr>
					</thead>
					<tbody>

					{volist name="projects" id="_project" key="key"}
						<tr class="text-c">
							<td><input type="checkbox" value="1" name=""></td>
							<td>{$key}</td>
							<td><u style="cursor:pointer" class="text-primary maincolor" onclick=project_show('项目详情',"{:url('project_show')}?id={$_project.id}")>{$_project.pname}</u></td>
<!--							<td>{$_project.pname}</td>-->
							<td>{$_project.ptype}</td>
							<td>{$_project->user->name}</td>
							<td>{$_project.lang}</td>
							<td>{$_project.cms}</td>
							<td>{$_project.front_url}</td>
							<td>{$_project.srv_url}</td>
							<td>{$_project.create_time}</td>
<!--							<td class="td-status"><span class="label label-success radius">已启用</span></td>-->
							<td class="td-manage">
<!--								<a style="text-decoration:none" onClick="member_stop(this,'10001')" href="javascript:;" title="停用">-->
<!--								<i class="Hui-iconfont">&#xe631;</i></a>-->
								<a title="编辑" href="javascript:;" onclick=project_edit('编辑',"{:url('update')}?id={$_project.id}",'','500') class="ml-5" style="text-decoration:none">
								<i class="Hui-iconfont">&#xe6df; &nbsp;</i></a>
<!--								<a style="text-decoration:none" class="ml-5" onClick="change_password('修改密码','change-password.html','10001','600','270')" href="javascript:;" title="修改密码">-->
<!--								<i class="Hui-iconfont">&#xe63f;</i></a>-->
								<a title="删除" href="javascript:;" onclick="project_del(this,{$_project.id})" class="ml-5" style="text-decoration:none">
								<i class="Hui-iconfont">&#xe6e2;</i></a>
							</td>
						</tr>
					{/volist}


					</tbody>
				</table>
			</div>
		</article>
	</div>
</section>

<!--_footer 作为公共模版分离出去-->
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__ADMIN__/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
$(function(){
	$('.table-sort').dataTable({
		"aaSorting": [[ 1, "desc" ]],//默认第几个排序
		"bStateSave": true,//状态保存
		"aoColumnDefs": [
		  // {"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
		  {"orderable":false,"aTargets":[0,3,4,5,6,7,10]}// 制定列不参与排序
		]
	})
	// $('.table-sort tbody').on( 'click', 'tr', function () {
	// 	if ( $(this).hasClass('selected') ) {
	// 		$(this).removeClass('selected');
	// 	}
	// 	else {
	// 		table.$('tr.selected').removeClass('selected');
	// 		$(this).addClass('selected');
	// 	}
	// });
});

$('.skin-minimal input').iCheck({
	checkboxClass: 'icheckbox-blue',
	radioClass: 'iradio-blue',
	increaseArea: '25%'
});



// 筛选项
$("#Huifold1").Huifold({
	titCell:'.item h4',
	mainCell:'.item .info',
	type: 1,
	trigger:'click',
	className:"selected",
	speed:"fast",
});





/* 批量删除 */
function datadel() {
    layer.msg('暂不支持此功能', {icon:7, time:1000});
}

/*项目-添加*/
function project_add(title,url,w,h){
	layer_show(title,url,w,h);
}
/*项目-查看*/
function project_show(title,url,id,w,h){
	layer_show(title,url,w,h);
}
/*用户-停用*/
function member_stop(obj,id){
	layer.confirm('确认要停用吗？',function(index){
		$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_start(this,id)" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe6e1;</i></a>');
		$(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已停用</span>');
		$(obj).remove();
		layer.msg('已停用!',{icon: 5,time:1000});
	});
}

/*用户-启用*/
function member_start(obj,id){
	layer.confirm('确认要启用吗？',function(index){
		$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_stop(this,id)" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>');
		$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
		$(obj).remove();
		layer.msg('已启用!',{icon: 6,time:1000});
	});
}
/*项目-编辑*/
function project_edit(title,url,w,h){
	layer_show(title,url,w,h);

}

/*项目-删除*/
function project_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
        console.log('即将删除项目'+id);
		$.get(
            "{:url('delete')}?id="+id,
             // "{:url('delete', ['id'=> " + id +"])}",
            // {'id': id},
            function(data) {
                data = JSON.parse(data);
                if (data.code === 0) {
                    layer.msg('已删除!', {icon: 1, time: 1000});
                    $(obj).parents("tr").remove();
                }else if (data.code === 4003) {
					layer.msg('对不起, 您没有删除权限 !', {icon: 5, time: 1500});
				}
                else {
                    layer.msg('删除失败', {icon: 5, time: 1000});
                }
            }
        );
	});
}
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>